package com.community.backend.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * 在WebSocketServer中发现不能注入redis，才有的此类
 */
@Component
public class RedisUtils {
    private static RedisTemplate<String, Object> redis;

    @Autowired
    public void setRedis(RedisTemplate<String, Object> redis) {
        RedisUtils.redis = redis;
    }

    public static RedisTemplate<String, Object> redis() {
        return redis;
    }
}